package cupk.abner;

import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;

public class RealSearcher extends Searcher{
    @Override
    String doSearch(String userId, String keyWord) {
        System.out.println("User " + userId + " is searching for " + keyWord);
        try {
            FileWriter fileWriter = new FileWriter("log.txt", true);
            PrintWriter printWriter = new PrintWriter(fileWriter);
            printWriter.println("用户" + userId + "查询了" + keyWord);
            printWriter.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
        return "查询成功";
    }
}